<?php

declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class CreateBizGoodsOrderMigration extends AbstractMigration
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change(): void
    {
        $this->table('biz_goods_order')
            ->addColumn('user_id', 'integer', ['null' => true])
            ->addColumn('biz_goods_id', 'integer', ['null' => true])
            ->addColumn('money', 'decimal', ['precision' => 10, 'scale' => 2, 'null' => true,'default' => 0.00,'comment' => '订单金额'])
            ->addColumn('status', 'string', ['null' => true,'limit' => 16,'default' => 'unpay','comment' => '订单状态'])
            ->addColumn('paid_at', 'integer', ['limit' => 11,'null' => true,'default' => 0,'comment' => '支付时间'])
            ->addColumn('created_at', 'integer', ['limit' => 11,'null' => true,'default' => 0,'comment' => '创建时间'])
            ->addColumn('updated_at', 'integer', ['limit' => 11,'null' => true,'default' => 0,'comment' => '更新时间'])
            ->addColumn('deleted_at', 'integer', ['limit' => 11,'null' => true,'comment' => '删除时间'])
            ->addColumn('transaction_id', 'string', ['null' => true,'limit' => 64,'comment' => '交易流水号'])
            ->create();
    }
}
